package com.xnck.example.jertest.util;


import com.xnck.example.jertest.exception.ValidateException;

/**
 * 浮点型辅助类
 */
public class NumberUtil {

    public static Double parseDouble(String str) throws ValidateException {
        try {
            return Double.parseDouble(str);
        } catch (Exception e) {
            throw new ValidateException("数字输入不正确");
        }
    }

    public static Integer parseInteger(String str) throws ValidateException {
        try {
            return Integer.parseInt(str);
        } catch (Exception e) {
            throw new ValidateException("数字输入不正确");
        }
    }
}
